import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '招标单位',
    align:"center",
    dataIndex: 'biddingUnit'
   },
   {
    title: '招标单位行业',
    align:"center",
    dataIndex: 'biddingUnitIndustry'
   },
   {
    title: '招标预算',
    align:"center",
    dataIndex: 'tenderAmount'
   },
   {
    title: '招标编码',
    align:"center",
    dataIndex: 'biddingNum'
   },
   {
    title: '招标方式',
    align:"center",
    dataIndex: 'tenderType'
   },
   {
    title: '投标开始时间',
    align:"center",
    dataIndex: 'startTime'
   },
   {
    title: '投标截止时间',
    align:"center",
    dataIndex: 'endTime'
   },
   {
    title: '开标时间',
    align:"center",
    dataIndex: 'tenderDate'
   },
   {
    title: '中标单位',
    align:"center",
    dataIndex: 'biddingWinner'
   },
   {
    title: '代理机构',
    align:"center",
    dataIndex: 'agency'
   },
   {
    title: '招标信息标题',
    align:"center",
    dataIndex: 'tenderTitle'
   },
   {
    title: '招标详情',
    align:"center",
    dataIndex: 'tenderDesc'
   },
   {
    title: '招标网站地址',
    align:"center",
    dataIndex: 'websiteUrl'
   },
   {
    title: '爬取时间',
    align:"center",
    dataIndex: 'crawlTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '招标单位',
    field: 'biddingUnit',
    component: 'Input',
  },
  {
    label: '招标单位行业',
    field: 'biddingUnitIndustry',
    component: 'Input',
  },
  {
    label: '招标预算',
    field: 'tenderAmount',
    component: 'InputNumber',
  },
  {
    label: '招标编码',
    field: 'biddingNum',
    component: 'Input',
  },
  {
    label: '招标方式',
    field: 'tenderType',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入招标方式!'},
          ];
     },
  },
  {
    label: '投标开始时间',
    field: 'startTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '投标截止时间',
    field: 'endTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '开标时间',
    field: 'tenderDate',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '中标单位',
    field: 'biddingWinner',
    component: 'Input',
  },
  {
    label: '代理机构',
    field: 'agency',
    component: 'Input',
  },
  {
    label: '招标信息标题',
    field: 'tenderTitle',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入招标信息标题!'},
          ];
     },
  },
  {
    label: '招标详情',
    field: 'tenderDesc',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入招标详情!'},
          ];
     },
  },
  {
    label: '招标网站地址',
    field: 'websiteUrl',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入招标网站地址!'},
          ];
     },
  },
  {
    label: '爬取时间',
    field: 'crawlTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  biddingUnit: {title: '招标单位',order: 0,view: 'text', type: 'string',},
  biddingUnitIndustry: {title: '招标单位行业',order: 1,view: 'text', type: 'string',},
  tenderAmount: {title: '招标预算',order: 2,view: 'number', type: 'number',},
  biddingNum: {title: '招标编码',order: 3,view: 'text', type: 'string',},
  tenderType: {title: '招标方式',order: 4,view: 'text', type: 'string',},
  startTime: {title: '投标开始时间',order: 5,view: 'datetime', type: 'string',},
  endTime: {title: '投标截止时间',order: 6,view: 'datetime', type: 'string',},
  tenderDate: {title: '开标时间',order: 7,view: 'datetime', type: 'string',},
  biddingWinner: {title: '中标单位',order: 8,view: 'text', type: 'string',},
  agency: {title: '代理机构',order: 9,view: 'text', type: 'string',},
  tenderTitle: {title: '招标信息标题',order: 10,view: 'text', type: 'string',},
  tenderDesc: {title: '招标详情',order: 11,view: 'text', type: 'string',},
  websiteUrl: {title: '招标网站地址',order: 12,view: 'text', type: 'string',},
  crawlTime: {title: '爬取时间',order: 13,view: 'datetime', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}